(iOS) Reinstate verification of main navigation in case of navigationType other #1023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
Cordova iOS
Motivation and Context
The PR that dropped UIWebView in favour of WKWebView (#773) introduced a bug that makes it so that iframe loads potentially jump out of the app and to Safari.
The current behavior is a problem for instance with Google Tag Manager. GTM might insert an iframe on the page with a source of
https://adservice.google.com
, or indeed any other country Google domain, depending on where the user is. This request would be sent out from the app and to Safari with the current implementation. Since the country domain might vary, it is impossible to approve this navigation in the<allow-navigation />
list in order to keep it within the app.Description
This PR reinstates a verification that if the navigation type is
other
(for instance an iframe) we verify that the navigation is actually happening in the main URL bar and not in an iframe before allowing the URL to be forwarded out of the app.Testing
I have made this change in my own app and verified that the behavior is the same as with Cordova iOS 5, before this change was introduced in Cordova iOS 6.
This issue seems very similar: #988
I have not added tests for this change. This plugin has no tests covering it today.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)